#include "StdAfx.h"
#include "SheetFactory.h"
#include "TestSheet1.h"

CSheetFactory::CSheetFactory(void)
{
}

void CSheetFactory::CreateAllSheet(std::vector<ISheetBase*>& vecSheet, CXTPExcelTabCtrl* pExcelTabCtrl)
{
	CCreateContext cc;
	::ZeroMemory(&cc, sizeof(cc));

	CWnd* pSheet;
	pSheet = (CWnd*)RUNTIME_CLASS(CTestSheet1)->CreateObject();
	if (!pSheet  || !pSheet->Create(
		NULL, NULL, WS_CHILD, CXTPEmptyRect(), pExcelTabCtrl,CTestSheet1::IDD , &cc))
	{
		TRACE0( "Failed to create CTestSheet1.\n" );
		pSheet = NULL;
	}
 	ISheetBase* pTmp = dynamic_cast<ISheetBase*>(pSheet);
 	if (pTmp == NULL)
 	{
 		TRACE0( "CTestSheet1 Convert To ISheetBase failed.\n" );
 	}
 	else
 	{
 		vecSheet.push_back(pTmp);
 	}
// 
// 	pSheet = (CWnd*)RUNTIME_CLASS(CTestSheet1)->CreateObject();
// 	if (!pSheet  || !pSheet->Create(
// 		NULL, NULL, WS_CHILD, CXTPEmptyRect(), pExcelTabCtrl,CTestSheet1::IDD , &cc))
// 	{
// 		TRACE0( "Failed to create CTestSheet1.\n" );
// 		pSheet = NULL;
// 	}
// 	pTmp = dynamic_cast<ISheetBase*>(pSheet);
// 	if (pTmp == NULL)
// 	{
// 		TRACE0( "CTestSheet1 Convert To ISheetBase failed.\n" );
// 	}
// 	else
// 	{
// 		vecSheet.push_back(pTmp);
// 	}
}